﻿@using KRM.Core
@using KRM.Core.Library
@model tblTicket

@section Scripts{
            <script src="/js/mail.js"></script>
    }
@{    
    var ListTags = ViewBag.ListTags as List<tblTag>;
    var listTicketTags = ViewBag.ListTicketTags as List<tblTicketTag>;
}
<form action="/EmailTicket/SaveEditTicket" id="frReplyEmail" method="POST" class="form-horizontal" role="form" enctype="multipart/form-data">
    <input type="hidden" id="TicketID" name="TicketID" value="@Model.TicketID"/>
    <input type="hidden" name="UserID" id="UserID" value="@Users.Current(User.Identity.Name).UserID"/>
    <div class="portlet box blue ">
        <div class="portlet-title">
                     <div class="caption">
                        Edit Ticket
                     </div>
         </div>
         <div class="portlet-body form">
                      <div class="form-body"> 
                                    
                           <div class="form-group">
                              <label  class="col-md-3 control-label">Subject</label>
                              <div class="col-md-9">
                                 <input id="Subject" name="Subject" type="text" class="form-control"  placeholder="" value ="Re: @Model.Subject">                                 
                              </div>
                           </div> 
                          <div class="form-group">
                              <label  class="col-md-3 control-label">Assign to user</label>
                              <div class="col-md-9">
                                 @Html.DropDownList("AssignedToUserID", null, new { @class = "form-control" })
                              </div>
                           </div>  
                           <div class="form-group">
                              <label  class="col-md-3 control-label">Date start</label>
                              <div class="col-md-9">
                                 <div Id="datetimepicker1"class="input-group input-medium date date-picker" data-date-format="dd/mm/yyyy" data-date-viewmode="years">
                                    <input type="text" name="DateStart" class="form-control" required="required" placeholder="dd/mm/yyyy" value="@Model.DateStarted.Value.ToString("dd/MM/yyyy")">
                                    <span class="input-group-btn">
                                        <button class="btn default" type="button"><i class="icon-calendar"></i></button>
                                    </span>
                                </div>
                              </div>
                           </div> 
                          
                          <div class="form-group">
                              <label  class="col-md-3 control-label">Tag</label>
                              <div class="col-md-9 form-control"  style="height: 130px; width:300px; overflow: auto; margin-left:15px;">
                                        @foreach (var item in ListTags)
                                        {
                                            if (listTicketTags.Contains(c=>c.TagID == item.TagID))
                                            {
                                                <div class="control" style="margin-left:10px;">
                                                    <label class="checkbox">
                                                        <input type="checkbox" name="Tag@(item.TagID)" checked="checked" value="@item.TagID"/>
                                                        @item.Tag
                                                    </label>
                                                </div>
                                            }
                                            else
                                            {
                                                <div class="control" style="margin-left:10px;">
                                                    <label class="checkbox">
                                                        <input type="checkbox" name="Tag@(item.TagID)" value="@item.TagID"/>
                                                        @item.Tag
                                                    </label>
                                                </div>
                                            }
                                        }
                                  </div>
                              </div>
                                          
                           <div class="form-group">
                              <label  class="col-md-3 control-label">Description</label>
                              <div class="col-md-9">
                                 <textarea class="form-control" rows="5" id ="Description" name ="Description">@Model.Description</textarea>
                                  </div>
                               </div>    
                     
                  </div>
                      </div>
</div>

    <div class="modal-footer">        
        <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
        <button type="submit" id="btnAccept" class="btn btn-primary"onclick="">Save</button>
    </div>

    </form>